package easymall.clients;

import easymall.po.Order;
import easymall.po.OrderItem;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("orderservice")
public interface OrderService {
    @PostMapping("/addOrder")
     void addOrder(@RequestParam String cartIds, @RequestBody Order order);

    @GetMapping("/findOrderByUserId")
    List<Order> findOrderByUserId(@RequestParam Integer user_id);

    @GetMapping("/getOrderItemsByOrderId")
     List<OrderItem> getOrderItemsByOrderId(@RequestParam String order_id);

    @GetMapping("/delOrder")
     void delOrder(@RequestParam String id);

    @GetMapping("/payOrder")
     void payOrder(@RequestParam String id);

    @GetMapping("/confirmOrder")
     void confirmOrder(@RequestParam String id);

    @PostMapping("/sendOrder")
     void sendOrder(@RequestBody Order order);

    @GetMapping("/getOrdersByPage")
     List<Order> getOrdersByPage(@RequestParam Integer page) ;

    @GetMapping("/totalPage")
     int totalPage();

    @GetMapping("/getOrderById")
     Order getOrderById(@RequestParam String id);

    @GetMapping("/findAllOrders")
     List<Order> findAllOrders();
}
